package com.hippo.javacore.multithreading;

import java.util.concurrent.Callable;

/**
 * @ClassName MyCallable
 * @Description TODO 实现Callable接口，重写call方法
 * @Author tangxl
 * @create 2023-03-10 15:35
 **/
public class MyCallable implements Callable<Integer> {
    @Override
    public Integer call() throws Exception {
        // 获取当前线程输出线程名称
        System.out.println(Thread.currentThread().getName()+"执行");
        // 求1~100之间的和
        int sum = 0;

        for (int i = 0; i <100 ;i++){
            sum += i;
        }
        return sum;
    }
}
